#ifdef linux
#include "tests/unit/unit_test.hpp"
#include <vector>
#include <string>
#include <iostream>

class String
{
public:
    String()
    {
        std::cout << "String()" << '\n';
    }
    ~String()
    {
        std::cout << "~String()" << '\n';
    }
    std::string m_name;
};

class Vec
{
public:
    Vec()
    {
        std::cout << "Vec()" << '\n';
    }
    ~Vec()
    {
        std::cout << "~Vec()" << '\n';
    }
    Vec(const Vec &rhs)
    {
        std::cout << "Vec(&)" << '\n';
        m_str.m_name = rhs.m_str.m_name;
    }
    Vec& operator=(const Vec &rhs)
    {
        std::cout << "operator=(&)" << '\n';
        m_str.m_name = std::move(rhs.m_str.m_name);
        return *this;
    }
    Vec& operator=(Vec &&rhs)
    {
        std::cout << "operator=(&&)" << '\n';
        m_str.m_name = std::move(rhs.m_str.m_name);
        rhs.m_str.m_name = "";
        return *this;
    }
    String m_str;
};

Vec create_and_insert()
{
    Vec vec;
    vec.m_str.m_name = "hello";
    std::cout << "vec.m_name:" << vec.m_str.m_name 
        << " &vec.m_name" << &vec.m_str.m_name << '\n';
    printf("data:%p\n", vec.m_str.m_name.data());
    return vec;
}

void test_move()
{
    Vec v;
    v = create_and_insert();
    std::cout << "v.m_name:" << v.m_str.m_name 
        << " &v.m_name" << &v.m_str.m_name << '\n';
    printf("data:%p\n", v.m_str.m_name.data());
}

int main()
{
    TEST_CASE(test_move);
    return 0;
}
#endif